<?php


namespace App\Http\Controllers\admin\validate;


use Illuminate\Support\Facades\Validator;

class Maintain
{
    public static function addClassify($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'name'=>'required',
            'imgUrl'=>'required',
            'gId'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'name.required'=>'分类名称为空',
            'imgUrl.required'=>'图片地址为空',
            'gId.required'=>'班级编号为空',
            'gId.numeric'=>'班级编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryClassify($param){
        $rules = [
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteClassify($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdClassify($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editClassify($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'name'=>'required',
            'imgUrl'=>'required',
            'gId'=>'required|numeric',
            'id'=>'required|numeric',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'name.required'=>'分类名称为空',
            'imgUrl.required'=>'图片地址为空',
            'gId.required'=>'班级编号为空',
            'gId.numeric'=>'班级编号格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addBrand($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'name'=>'required',
            'imgUrl'=>'required',
            'gName'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'name.required'=>'分类名称为空',
            'imgUrl.required'=>'图片地址为空',
            'gName.required'=>'班级名称为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryBrand($param){
        $rules = [
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteBrand($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdBrand($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editBrand($param){
        $rules = [
            'userId'=>'required|numeric',
            'id'=>'required|numeric',
            'lastIp'=>'required|ip',
            'name'=>'required',
            'imgUrl'=>'required',
            'gName'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'name.required'=>'分类名称为空',
            'imgUrl.required'=>'图片地址为空',
            'gName.required'=>'班级名称为空',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addTopic($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'name'=>'required',
            'imgUrl'=>'required',
            'gName'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'name.required'=>'分类名称为空',
            'imgUrl.required'=>'图片地址为空',
            'gName.required'=>'班级名称为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryTopic($param){
        $rules = [
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdTopic($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editTopic($param){
        $rules = [
            'userId'=>'required|numeric',
            'id'=>'required|numeric',
            'name'=>'required',
            'lastIp'=>'required|ip',
            'imgUrl'=>'required',
            'gName'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'name.required'=>'分类名称为空',
            'imgUrl.required'=>'图片地址为空',
            'gName.required'=>'班级名称为空',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteTopic($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function uploadMaintainImg($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'file'=>'required|file'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'file.required'=>'图片为空',
            'file.file'=>'图片格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }
}